home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1795 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.4 KB  |  46 lines

  1. Path: news.bridge.net!news
  2. From: David Byrden <100101.2547@compuserve.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: What is RTTI?
  5. Date: 13 Jan 1996 00:29:25 GMT
  6. Organization: self-employed
  7. Message-ID: <4d6ud5$3b7@news.bridge.net>
  8. References: <30F69796.167E@unuts.gi.com>
  9. NNTP-Posting-Host: ppp-mia1-64.bridge.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=iso-8859-1
  12. Content-Transfer-Encoding: 8bit
  13. X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
  14.  
  15.  
  16. Cindy;
  17.  
  18. operator typeid( ) takes a type name or expression & returns a const 
  19. type_info&. This is a reference to a typeinfo object generated by the 
  20. system. This object represents the static type of the expression. 
  21.  
  22. Class typeinfo objects are intended only to be compared to others using 
  23. == and !=. 
  24.  
  25. typeinfo has a member function const char* name( ) returning the typeÆs 
  26. textual name. 
  27.  
  28. typeinfo has a member function int before( ) allowing you to sort based 
  29. on types. The ordering is valid only during the execution of the program. 
  30. It has no relationship to inheritance.
  31.  
  32. typeinfo has a virtual destructor, and can be inherited by the compiler 
  33. implementor to provide extra services.
  34.  
  35. dynamic_cast<> is used to navigate safely down class hierarchies,
  36. changing a base pointer or reference into a derived type, after 
  37. you ensure that the type is correct by using RTTI.
  38.  
  39.  
  40.  
  41.                     David Byrden
  42.  
  43.         C++ training for software professionals
  44.  
  45.  
  46.